(function(){
	
	//4.1购买商品
	var user_a = require("./3.用户注册与登录").user_a;
	var bus_a = require("./3.用户注册与登录").bus_a;
	var UserCartGoodsCon = require("../user.cart_goods/_con");
	//查找商品
	var goods = bus_a.getGoodsByName("小包包");
	if (goods) {
		bus_a.addBuffForGoods(goods._id,{
			name:"我爱打折",
			intro:"清仓5折！！！！，购买此商品即可享受",
			code_id:"单个商品-打折",
			config:{
				discount:0.1
			},
			eventName:"beforePay"
		});
		//加入购物车
		var cart_id_1 = user_a.addGoodsToCart([{goods_id:goods._id}],bus_a._id);

		console.log(UserCartGoodsCon.get(cart_id_1));
		//查看购物车详情
		console.log(user_a.getCartDetail());
		//再加一次
		var cart_id_2 = user_a.addGoodsToCart([{goods_id:goods._id}],bus_a._id);

		console.log(UserCartGoodsCon.get(cart_id_1));

		console.log(cart_id_2===cart_id_1);
		//查看购物车详情
		console.log(user_a.getCartDetail());

	}

	module.exports = {
		bus_a:bus_a,
		user_a:user_a,
		cart_id_1:cart_id_1,
	};
}());
